/*
* @Description: 
* @version: 
* @Author: XiaoQiYan
* @Date: 2021-08-22 15:08:35
 * @LastEditors: XiaoQiYan
 * @LastEditTime: 2021-08-22 15:17:07
*/
public class People {
    public void peopleInfo(){
        final String sex = "man";
        class Student{
            String ID = "20151234";
            public void print(){
                System.out.println("访问外部类的方法中的常量sex"+sex);
                System.out.println("访问内部类中的变量ID:"+ID);
            }
        }
        Student a = new Student();
        a.print();
    }
    public void peopleInfo2(boolean b){
        if (b){
            final String sex = "man";
            class Student {
                String ID = "20151234";

                public void print() {
                    System.out.println("访问外部类的方法中的常量sex" + sex);
                    System.out.println("访问内部类中的变量ID:" + ID);
                }
            }
            Student a = new Student();
            a.print();
        }
    }
    public static void main(String[] args) {
        People b = new People();
        System.out.println("定义在方法内:==========");
        b.peopleInfo();
        System.out.println("定义在方法内:==========");
        b.peopleInfo2(true);
    }
}
